<template>
  <div>
    <a-table
      :columns="columns"
      :data-source="alarms"
      :rowKey="(record, index) => index"
      size="small"
    >
      <span slot="opertion" slot-scope="text, record" v-if="showOperation">
        <a @click="forceClear(record)">强制消除</a>
      </span>
    </a-table>
  </div>
</template>
<script>
const columns = [
  {
    title: "设备",
    dataIndex: "thing_name",
  },
  {
    title: "设备id",
    dataIndex: "t_id",
  },
  {
    title: "站点",
    dataIndex: "station_name",
  },
  {
    title: "告警",
    dataIndex: "alarm_name",
  },

  {
    title: "索引",
    dataIndex: "mindex",
  },
  {
    title: "级别",
    dataIndex: "level",
  },
  {
    title: "告警时间",
    dataIndex: "alarm_time",
  },
  {
    title: "消除时间",
    dataIndex: "clear_time",
  },
  {
    title: "告警原因",
    dataIndex: "params['reason']",
  },
  {
    title: "相关量",
    dataIndex: "properties",
  },
  {
    title: "操作",
    dataIndex: "opertion",
    scopedSlots: { customRender: "opertion" },
  },
];
import {forceAalarm} from '@/services/alarmAPI'
export default {
  data() {
    return {
      columns,
    };
  },
  props: ["alarms", "showOperation"],
  methods: {
    forceClear(alarm) {
      forceAalarm(alarm.t_id,alarm.alarm_id,0,"END")
    },
  },
};
</script>
